package com.shoubei.cashiedesk.event;

import android.content.Context;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.facade.service.SerializationService;
import com.google.gson.Gson;

import java.lang.reflect.Type;

/**
 * Created by lw on 2018/1/25.
 */
@Route(path = "/custom/json")
public class LoginEvent implements SerializationService{


    /**
     * id : 201904090911085cabf12c
     * mobile : 15717815765
     * username : test
     * nickname : 刘德华
     * email : a4717@163.com
     * gmt_create : 2019-05-15 20:51:59
     * token : b873611c7ff3f47791f1bd558806dc83
     * role : manager
     * shop : {"id":"201904090910305cabf106","merchant_id":"201904090912045cabf164","name":"测试门店001","contact":"刘德华","mobile":"17888888888","email":"9898@qq.com","province":"110000","city":"110100","district":"110101","address":"北京市朝阳区888号","status":"online","business_type":"SANCK","table_fee":1,"service_fee":0,"open_table":"STOP"}
     * manager : {"id":"201904090911085cabf12c","mobile":"15717815765","username":"test","nickname":"刘德华","email":"a4717@163.com","gmt_create":"2019-04-03 16:11:52"}
     * merchant : {"id":"201904090912045cabf164","name":"测试商户 10002"}
     */

    private String id;
    private String mobile;
    private String username;
    private String nickname;
    private String email;
    private String gmt_create;
    private String token;
    private String role;
    private ShopBean shop;
    private ManagerBean manager;
    private MerchantBean merchant;
    private Gson gson;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getGmt_create() {
        return gmt_create;
    }

    public void setGmt_create(String gmt_create) {
        this.gmt_create = gmt_create;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public ShopBean getShop() {
        return shop;
    }

    public void setShop(ShopBean shop) {
        this.shop = shop;
    }

    public ManagerBean getManager() {
        return manager;
    }

    public void setManager(ManagerBean manager) {
        this.manager = manager;
    }

    public MerchantBean getMerchant() {
        return merchant;
    }

    public void setMerchant(MerchantBean merchant) {
        this.merchant = merchant;
    }

    @Override
    public <T> T json2Object(String input, Class<T> clazz) {
        return gson.fromJson(input,clazz);
    }

    @Override
    public String object2Json(Object instance) {
        return gson.toJson(instance);
    }

    @Override
    public <T> T parseObject(String input, Type clazz) {
        return gson.fromJson(input,clazz);
    }

    @Override
    public void init(Context context) {
        gson = new Gson();
    }

    public static class ShopBean implements SerializationService{
        /**
         * id : 201904090910305cabf106
         * merchant_id : 201904090912045cabf164
         * name : 测试门店001
         * contact : 刘德华
         * mobile : 17888888888
         * email : 9898@qq.com
         * province : 110000
         * city : 110100
         * district : 110101
         * address : 北京市朝阳区888号
         * status : online
         * business_type : SANCK
         * table_fee : 1.0
         * service_fee : 0.0
         * open_table : STOP
         */

        private String id;
        private String merchant_id;
        private String name;
        private String contact;
        private String mobile;
        private String email;
        private String province;
        private String city;
        private String district;
        private String address;
        private String status;
        private String business_type;
        private double table_fee;
        private double service_fee;
        private String open_table;
        private Gson gson;

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getMerchant_id() {
            return merchant_id;
        }

        public void setMerchant_id(String merchant_id) {
            this.merchant_id = merchant_id;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getContact() {
            return contact;
        }

        public void setContact(String contact) {
            this.contact = contact;
        }

        public String getMobile() {
            return mobile;
        }

        public void setMobile(String mobile) {
            this.mobile = mobile;
        }

        public String getEmail() {
            return email;
        }

        public void setEmail(String email) {
            this.email = email;
        }

        public String getProvince() {
            return province;
        }

        public void setProvince(String province) {
            this.province = province;
        }

        public String getCity() {
            return city;
        }

        public void setCity(String city) {
            this.city = city;
        }

        public String getDistrict() {
            return district;
        }

        public void setDistrict(String district) {
            this.district = district;
        }

        public String getAddress() {
            return address;
        }

        public void setAddress(String address) {
            this.address = address;
        }

        public String getStatus() {
            return status;
        }

        public void setStatus(String status) {
            this.status = status;
        }

        public String getBusiness_type() {
            return business_type;
        }

        public void setBusiness_type(String business_type) {
            this.business_type = business_type;
        }

        public double getTable_fee() {
            return table_fee;
        }

        public void setTable_fee(double table_fee) {
            this.table_fee = table_fee;
        }

        public double getService_fee() {
            return service_fee;
        }

        public void setService_fee(double service_fee) {
            this.service_fee = service_fee;
        }

        public String getOpen_table() {
            return open_table;
        }

        public void setOpen_table(String open_table) {
            this.open_table = open_table;
        }

        @Override
        public <T> T json2Object(String input, Class<T> clazz) {
            return gson.fromJson(input,clazz);
        }

        @Override
        public String object2Json(Object instance) {
            return gson.toJson(instance);
        }

        @Override
        public <T> T parseObject(String input, Type clazz) {
            return gson.fromJson(input,clazz);
        }

        @Override
        public void init(Context context) {
            gson = new Gson();
        }
    }

    public static class ManagerBean implements SerializationService{
        /**
         * id : 201904090911085cabf12c
         * mobile : 15717815765
         * username : test
         * nickname : 刘德华
         * email : a4717@163.com
         * gmt_create : 2019-04-03 16:11:52
         */

        private String id;
        private String mobile;
        private String username;
        private String nickname;
        private String email;
        private String gmt_create;
        private Gson gson;

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getMobile() {
            return mobile;
        }

        public void setMobile(String mobile) {
            this.mobile = mobile;
        }

        public String getUsername() {
            return username;
        }

        public void setUsername(String username) {
            this.username = username;
        }

        public String getNickname() {
            return nickname;
        }

        public void setNickname(String nickname) {
            this.nickname = nickname;
        }

        public String getEmail() {
            return email;
        }

        public void setEmail(String email) {
            this.email = email;
        }

        public String getGmt_create() {
            return gmt_create;
        }

        public void setGmt_create(String gmt_create) {
            this.gmt_create = gmt_create;
        }

        @Override
        public <T> T json2Object(String input, Class<T> clazz) {
            return gson.fromJson(input,clazz);
        }

        @Override
        public String object2Json(Object instance) {
            return gson.toJson(instance);
        }

        @Override
        public <T> T parseObject(String input, Type clazz) {
            return gson.fromJson(input,clazz);
        }

        @Override
        public void init(Context context) {
            gson = new Gson();
        }
    }

    public static class MerchantBean implements SerializationService{
        /**
         * id : 201904090912045cabf164
         * name : 测试商户 10002
         */

        private String id;
        private String name;
        private Gson gson;

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        @Override
        public <T> T json2Object(String input, Class<T> clazz) {
            return gson.fromJson(input,clazz);
        }

        @Override
        public String object2Json(Object instance) {
            return gson.toJson(instance);
        }

        @Override
        public <T> T parseObject(String input, Type clazz) {
            return gson.fromJson(input,clazz);
        }

        @Override
        public void init(Context context) {
            gson = new Gson();
        }
    }
}
